(function (aopc) {
    aopc.addExpandPage(861, function (get) {
        const Common = get('UtilsCommon', 'Common');

        return {
            expandInit() {
                this.annotationsProperty = this.getProperty('Annotations');
                this.look_img_view = this.getProperty('look_img_view');
                this.imgProperty = this.getViewProperty(this.look_img_view, 'ImageUrl');
            },
            refreshDataList() {
                this.annotationsProperty.id = Common.createGuid();
                this.annotationsProperty.isCache = false;
                this.annotationsProperty.refreshOptions();
            },
            getMeetingId() {
                const { MeetingId } = this.pageData;
                const { UserId } = this.visitUser;
                return { url: `ViewMeetingRecord?$select=RecordId,ImageUrl,Name,RowVersion&$filter=RecordType eq 1 and MeetingId eq @MeetingId and CreateUser eq @CreateUser&@MeetingId=${MeetingId}&@CreateUser=${UserId}&$orderby=CreateDate desc` };
            },
            lookImage({ property }) {
                this.imgProperty.value = property.value;
                this.look_img_view.setIsVisible(true);
            },
            deleteItem({ property, view }) {
                if (property.isLoading) return;

                const { serviceInterface } = property;
                const { RecordId, RowVersion, Name } = view.entityData;
                this.confirm(`确定要删除${Name}该批注吗？`, () => {
                    const { serviceName, actionName } = serviceInterface;
                    const payload = { url: `MeetingRecord(${RecordId})?RowVersion=${RowVersion}` }

                    property.isLoading = true;
                    this.dispatchAction(serviceName, actionName, payload).then(res => {
                        property.isLoading = false;
                        if (res.isSuccess !== false) {
                            this.alertSuccess('删除成功！', () => {
                                this.refreshDataList();
                            });
                        }
                    });
                });
            },
        }
    });
})(window.aopc);